package edu.xhu.view;

import edu.xhu.R;

import android.content.Context;
import android.graphics.drawable.BitmapDrawable;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup.LayoutParams;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.view.animation.TranslateAnimation;
import android.widget.PopupWindow;
import android.widget.ViewFlipper;

/**
 * 该类用来实现展示大的图片。使用的地方：微博中点击一张图片则放大展示
 * 
 * @author swerit
 * 
 */
public class LoadingDialog {
	// 最上面一层的透明弹窗
	private static PopupWindow mPopArtical;
	private static View popView;
	private static LayoutInflater layoutInflater;
	
	/**
	 * 将图片放大显示
	 * @param context：要显示这个弹窗的上下文
	 * @param picUrl：要显示的图片的链接
	 */
	public static void showWindow(Context context){
		layoutInflater 	 = LayoutInflater.from(context);
		popView 		 = layoutInflater.inflate(R.layout.progress_dialog, null);
		dismiss();
		
		//初始化弹窗
		mPopArtical = new PopupWindow(popView, LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
		mPopArtical.showAtLocation(popView, Gravity.CENTER, 0, 0);
	}
	
	public static void dismiss(){
		if (mPopArtical!=null && mPopArtical.isShowing()){
			mPopArtical.dismiss();
			mPopArtical = null;
		}
	}
	
	
	public static boolean isShowing(){
		if (mPopArtical != null)
			return mPopArtical.isShowing();
		
		return false;
	}
}
